<%@ page contentType="text/html;charset=UTF-8" language="java"%>
<!DOCTYPE html>
<html lang="en">

<head>

<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">

<title>CRM-客户关系管理系统</title>

<!-- JQuery JBox CSS -->
<link href="static/js/GreyBlue/jbox.css" rel="stylesheet">
<!-- Bootstrap Core CSS -->
<link
	href="http://cdn.bootcss.com/bootstrap/3.3.6/css/bootstrap.min.css"
	rel="stylesheet">

<!-- MetisMenu CSS -->
<link href="static/js/metisMenu/metisMenu.min.css" rel="stylesheet">

<!-- Custom CSS -->
<link href="static/css/sb-admin-2.css" rel="stylesheet">

<!-- Custom Fonts -->
<link href="static/css/font-awesome.min.css" rel="stylesheet"
	type="text/css">

<link rel="stylesheet"
	href="static/js/datatables/media/css/dataTables.bootstrap.min.css">

<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
    <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
    <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->

</head>

<body>
	<div id="wrapper">
		<%@ include file="include/nav.jsp"%>

		<!-- Page Content -->
		<div id="page-wrapper">
			<div class="container-fluid">
				<div class="row">
					<div class="col-lg-12">
						<h4 class="page-header">用户个人管理</h4>

						<div class="panel panel-default" style="width:70%">
							<div class="panel-heading">
								账号信息 <a href="javascript:;" id="addNewUser"
									class="btn btn-success btn-xs pull-right"><i
									class="fa fa-plus"></i> 修改信息</a>
							</div>
							<div class="modal-dialog">
								<form id="currentUserForm" class="form-horizontal">
									<div class="form-group">
										<label class="col-sm-2 control-label">姓名：</label>
										<div class="col-sm-10">
											<input type="text" class="form-control" name="username" value="${user.username }" readonly="true">
										</div>
									</div>
									<div class="form-group">
										<label class="col-sm-2 control-label">联系电话：</label>
										<div class="col-sm-10">
											<input type="text" class="form-control" name="tel" value="${user.tel }"  readonly="true">
										</div>
									</div>
									<div class="form-group">
										<label class="col-sm-2 control-label">当前状态：</label>
										<div class="col-sm-10">
											<div class="checkbox">
												<input type="text" class="form-control" name="role" value='${user.state}' readonly="true">
											</div>
										</div>
									</div>
									<div class="form-group">
										<label class="col-sm-2 control-label">微信号：</label>
										<div class="col-sm-10">
											<div class="checkbox">
												<input type="text" class="form-control" name="role" value='${user.weixinid}' readonly="true">
											</div>
										</div>

									</div>
									
									<div class="form-group">
										<label class="col-sm-2 control-label">角色：</label>
										<div class="col-sm-10">
											<div class="checkbox">
												<input type="text" class="form-control" name="role" value='${role}' readonly="true">
											</div>
										</div>

									</div>
								</form>
							</div>
						</div>


					</div>
					<!-- /.col-lg-12 -->
				</div>
				<!-- /.row -->
			</div>
			<!-- /.container-fluid -->
		</div>
		<!-- /#page-wrapper -->
	</div>
	<div class="modal fade" id="newUserModal">
		<div class="modal-dialog">
			<div class="modal-content">
				<div class="modal-header">
					<button type="button" class="close" data-dismiss="modal"
						aria-label="Close">
						<span aria-hidden="true">&times;</span>
					</button>
					<h4 class="modal-title">修改当前用户信息</h4>
				</div>
				<div class="modal-body">
					<form id="newUserForm" class="form-horizontal">
					<input type="text"  name="id" value="${user.id }" hidden="hidden">
						<div class="form-group">
							<label class="col-sm-2 control-label">姓名：</label>
							<div class="col-sm-10">
								<input type="text" class="form-control" name="username" value="${user.username }" readonly="readonly">
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-2 control-label">密码：</label>
							<div class="col-sm-10">
								<input type="password" class="form-control" name="password">
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-2 control-label">电话：</label>
							<div class="col-sm-10">
								<input type="text" class="form-control" name="tel" value="${user.tel }">
							</div>
						</div>
					
						<div class="form-group">
							<label class="col-sm-2 control-label">微信号：</label>
							<div class="col-sm-10">
								<input type="text" class="form-control" name="weixinid" value='${user.weixinid}'>
							</div>
						</div>
						
					</form>
				</div>
				<div class="modal-footer">
					<button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
					<button type="button" id="updateBtn" class="btn btn-primary">确定修改</button>
				</div>
			</div>
			<!-- /.modal-content -->
		</div>
		<!-- /.modal-dialog -->
	</div>
	<!-- /.modal -->

	<!-- jQuery -->
	<script src="static/js/jquery.min.js"></script>
	<script src="http://code.jquery.com/jquery-migrate-1.1.1.js"></script>
	<script src="static/js/jquery.jBox-2.3.min.js"></script>
	<script src="static/js/jquery.jBox-zh-CN.js"></script>
	<!-- Bootstrap Core JavaScript -->
	<script src="static/js/bootstrap.min.js"></script>

	<!-- Metis Menu Plugin JavaScript -->
	<script src="static/js/metisMenu/metisMenu.min.js"></script>

	<!-- Custom Theme JavaScript -->
	<script src="static/js/sb-admin-2.js"></script>
	<script src="static/js/datatables/media/js/jquery.dataTables.min.js"></script>
	<script src="static/js/datatables/media/js/dataTables.bootstrap.min.js"></script>
	
	<script>	
	//修改当前账户信息
		$(function() {
			//点击显示隐藏的修改页面
			$("#addNewUser").click(function(){
				$("#newUserModal").modal('show');
			})
				$("#updateBtn").click(
					function() {
						//序列化表单
						var arr = $("#newUserForm").serialize();
						//进行编码
						arr = decodeURIComponent(arr,true);
						$.ajax({  
				            url:"updateUser",  
				            data:arr,  
				            type:"post",  
				            dataType:"json", 
				            success:function(){  
				                 jBox.success("信息修改成功马上跳转登录界面，请重新登录!!!!",'', { closed: function () { location.href='logout' } }); 
				            	} ,
				            error:function(){  
				            	$.jBox.error('信息修改失败，请重新进行操作', '错误提示');
				            }  
				  });
			})
		})
	</script>

</body>

</html>
